<script lang="ts" setup>
import { ref } from 'vue'
import { someFieldStore } from "@/stores/somefield";
import { getUrlParamValue } from "@/utils/getUrlParams";
import { request } from "@/service/request";


const mSomefield = someFieldStore();

//协议参数
function buildKfUrlParams() {
        const params = new URLSearchParams();

        if (getUrlParamValue('company', mSomefield.clientfields) != null && getUrlParamValue('company', mSomefield.clientfields) != '' && getUrlParamValue('company', mSomefield.clientfields) != "0") {
                const companyValue = getUrlParamValue('company', mSomefield.clientfields) || '';
                params.append('company', companyValue);
        }

        // 处理game_id (必传)
        const gameId = getUrlParamValue('game_id', mSomefield.clientfields);
        params.append('game_id', gameId || '0');

        return params.toString();
}

//获取用户协议
const mAgreement = ref();
const clkGetAgreement = async () => {
        mAgreement.value = await request.get<any>(`/sdk/sys/protocol?${buildKfUrlParams()}&type=1`);
}
clkGetAgreement()


</script>
<template>
        <div class="gr-yonghu" v-richText="mAgreement" v-if="mAgreement">
        </div>
</template>

<style lang="scss" scoped>
.gr-yonghu {
        overflow-y: auto;
        max-height: 1000px;
}
</style>